import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const state = {
	curimg:'../static/image/test/icon.png',
	curindex: 0,
	isplayingmusic: false,
	isplayactive: false,
	playdetail: '',
	audiolist: [],
}

const getters = {
	isplayingmusic(state) {
		return state.isplayingmusic
	},
	isplayactive(state) {
		return state.isplayactive
	},
	playdetail(state) {
		return state.playdetail;
	},
	audiolist(state) {
		return state.audiolist
	},
	curimg(state){
		return state.curimg
	},
	curindex(state){
		return state.curindex
	}
}

const mutations = {
	setIsplayingmusic(state, param) {
		state.isplayingmusic = param
	},
	setIsplayactive(state, param) {
		state.isplayactive = param
	},
	setPlaydetail(state, param){
		state.playdetail = param
	},
	setAudiolist(state, param) {
		state.audiolist = param
	},
	setCurImg(state, param){
		state.curimg = param
	},
	setCurIndex(state, param){
		state.curindex = param
	}
}

const actions = {
	isplayingmusicAction(context, param){
		context.commit('setIsplayingmusic')
	}
}

var vuexStore = new Vuex.Store({
	state,
	mutations,
	getters,
	actions
})

export default vuexStore
